#ifndef DEVLIST_VIEW_H
#define DEVLIST_VIEW_H

#include <QTreeView>

class QMenu;
class QAction;
class DevlistModel;

class DevlistView : public QTreeView 
{
    Q_OBJECT
public:
    explicit DevlistView(QWidget *parent = nullptr);
    virtual ~DevlistView();

    void defaultExpand();
    void showSearch(const QString& strSearch);
	
protected:
    void paintEvent(QPaintEvent *event) override;

private slots:
    void OnShowDevlistMenu(const QPoint&);
    void actionExpand();

protected:
    void initForm();
    void initMenu();

    void expandTree(const QModelIndex &index);

private:
    QMenu *mMenu;           //右键菜单
    QAction* mExpandAction;
    QAction* mStoreAction;
    QAction* mAllOpenAction;
    QAction* mAllCloseAction;
    QAction* mDeviceAction;

    DevlistModel* mModel;

};

#endif // DEVLIST_VIEW_H
